#include <iostream>

// 基类 Shape
class Shape {
public:
    virtual void draw() const {
        std::cout << "Drawing a shape..." << std::endl;
    }
};

// 派生类 Circle
class Circle : public Shape {
public:
    void draw() const override {
        std::cout << "Drawing a circle..." << std::endl;
    }
};

// 派生类 Rectangle
class Rectangle : public Shape {
public:
    void draw() const override {
        std::cout << "Drawing a rectangle..." << std::endl;
    }
};

int main() {
    Shape *shape;
    Circle circle;
    Rectangle rectangle;

    // 指向 Circle 对象
    shape = &circle;
    shape->draw(); // 输出 "Drawing a circle..."

    // 指向 Rectangle 对象
    shape = &rectangle;
    shape->draw(); // 输出 "Drawing a rectangle..."

    return 0;
}